]> git.r.bdr.sh - rbdr/super-polarity/blob - Super Polarity/ActorFactory.cs
Stuffffffff
[rbdr/super-polarity] / Super Polarity / ActorFactory.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using Microsoft.Xna.Framework;
6 using Microsoft.Xna.Framework.Graphics;
7 using Microsoft.Xna.Framework.Content;
8
9 namespace SuperPolarity
10 {
11 static class ActorFactory
12 {
13 static internal SuperPolarity Game;
14
15 static public MainShip CreateMainShip(Vector2 position)
16 {
17 MainShip mainShip = new MainShip(Game);
18 mainShip.Initialize(Game.Content.Load<Texture2D>("Graphics\\main-ship"), position);
19
20 ActorManager.CheckIn(mainShip);
21 Renderer.CheckIn(mainShip);
22
23 return mainShip;
24 }
25
26 static public StandardShip CreateShip(Ship.Polarity polarity, Vector2 position)
27 {
28 StandardShip ship = new StandardShip(Game);
29 Texture2D texture;
30
31 if (polarity == Ship.Polarity.Positive)
32 {
33 texture = Game.Content.Load<Texture2D>("Graphics\\positive-ship");
34 }
35 else if (polarity == Ship.Polarity.Negative)
36 {
37 texture = Game.Content.Load<Texture2D>("Graphics\\negative-ship");
38 }
39 else
40 {
41 texture = Game.Content.Load<Texture2D>("Graphics\\neutral-ship");
42 }
43
44 ship.Initialize(texture, position);
45 ship.SetPolarity(polarity);
46
47 ActorManager.CheckIn(ship);
48 Renderer.CheckIn(ship);
49
50 return ship;
51 }
52
53 internal static void SetGame(SuperPolarity game)
54 {
55 ActorFactory.Game = game;
56 }
57
58 internal static Bullet CreateBullet(Vector2 position, float angle)
59 {
60 Bullet bullet = new Bullet(Game);
61
62 bullet.Initialize(Game.Content.Load<Texture2D>("Graphics\\square"), position);
63
64 bullet.Angle = angle;
65
66 ActorManager.CheckIn(bullet);
67 Renderer.CheckIn(bullet);
68
69 return bullet;
70 }
71
72 static public StandardShip CreateScout(Ship.Polarity polarity, Vector2 position)
73 {
74 StandardShip ship = new StandardShip(Game);
75 Texture2D texture;
76
77 if (polarity == Ship.Polarity.Positive)
78 {
79 texture = Game.Content.Load<Texture2D>("Graphics\\positive-scout");
80 }
81 else if (polarity == Ship.Polarity.Negative)
82 {
83 texture = Game.Content.Load<Texture2D>("Graphics\\negative-scout");
84 }
85 else
86 {
87 texture = Game.Content.Load<Texture2D>("Graphics\\neutral-scout");
88 }
89
90 ship.BoxDimensions.X = 10;
91 ship.BoxDimensions.Y = 10;
92 ship.BoxDimensions.W = 10;
93 ship.BoxDimensions.Z = 10;
94
95 ship.Initialize(texture, position);
96 ship.MaxVelocity = 5.5f;
97 ship.FleeVelocity = 6.5f;
98 ship.ChargeVelocity = 5.5f;
99 ship.Value = 3;
100 ship.HP = 0;
101 ship.AngleChangeProbability = 20;
102 ship.SetPolarity(polarity);
103
104 ActorManager.CheckIn(ship);
105 Renderer.CheckIn(ship);
106
107 return ship;
108 }
109
110 static public StandardShip CreateCruiser(Ship.Polarity polarity, Vector2 position)
111 {
112 StandardShip ship = new StandardShip(Game);
113 Texture2D texture;
114
115 if (polarity == Ship.Polarity.Positive)
116 {
117 texture = Game.Content.Load<Texture2D>("Graphics\\positive-cruiser");
118 }
119 else if (polarity == Ship.Polarity.Negative)
120 {
121 texture = Game.Content.Load<Texture2D>("Graphics\\negative-cruiser");
122 }
123 else
124 {
125 texture = Game.Content.Load<Texture2D>("Graphics\\neutral-cruiser");
126 }
127
128 ship.BoxDimensions.X = 40;
129 ship.BoxDimensions.Y = 40;
130 ship.BoxDimensions.W = 40;
131 ship.BoxDimensions.Z = 40;
132
133 ship.Initialize(texture, position);
134 ship.MaxVelocity = 0.5f;
135 ship.FleeVelocity = 5;
136 ship.ChargeVelocity = 1;
137 ship.Value = 10;
138 ship.HP = 9;
139 ship.SetPolarity(polarity);
140
141 ActorManager.CheckIn(ship);
142 Renderer.CheckIn(ship);
143
144 return ship;
145 }
146 }
147 }